﻿<%@ Page Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeFile="SalesOrder.aspx.cs" Inherits="SalesOrder" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="SalesOrder" ContentPlaceHolderID="MainContent" runat="server">
    <asp:Label ID="Label1" Font-Bold="true" ForeColor="Maroon" Font-Size="XX-Large" Text="Sales Order" runat="server" />
    <br /><br />
    <table border="0">
        <tr>
            <td>
                <b><font color="maroon">Date: </font></b>
                <asp:Label ID="TodayDate" runat="server" />
            </td>
        </tr>
        <tr>
            <td>
                <b><font color="maroon">Order Number: </font></b>
                <asp:Label ID="CTIDLabel" runat="server" />
            </td>
        </tr>
    </table>
    <br />
<asp:SqlDataSource ID="sdsDB" 
        ConnectionString="<%$ connectionStrings: AccessConnectionDB %>" 
        ProviderName="<%$ connectionStrings:AccessConnectionDB.ProviderName %>"
        runat="server" />

<asp:AccessDataSource ID="sdsDB2" runat="server" DataFile="~/App_Data/Database1.accdb"
    SelectCommand="SELECT c.*, p.PD_NAME, p.PD_PRICE 
    FROM CART c INNER JOIN PRODUCT p on c.PD_ID=p.PD_ID
    WHERE CT_ID = @CT_ID">
    <SelectParameters>
        <asp:ControlParameter Name="CT_ID" ControlID="CTIDLabel" PropertyName="Text" />
    </SelectParameters>
</asp:AccessDataSource>

<asp:GridView id="ShoppingCartGrid" DataSourceID="sdsDB2" runat="server"
    AutoGenerateColumns="false"
    Cellpadding="3"
    ShowFooter="true">
    <Columns>

    <asp:BoundField HeaderText="ID" HeaderStyle-BackColor="Maroon" HeaderStyle-ForeColor="White"
        DataField="PD_ID"
        ItemStyle-Width="50" FooterStyle-BackColor="Maroon" FooterStyle-ForeColor="White" />

    <asp:BoundField HeaderText="Name" HeaderStyle-BackColor="Maroon" HeaderStyle-ForeColor="White"
        DataField="PD_NAME"
        ItemStyle-Width="200" FooterStyle-BackColor="Maroon" FooterStyle-ForeColor="White" />

    <asp:BoundField HeaderText="Price" HeaderStyle-BackColor="Maroon" HeaderStyle-ForeColor="White"
        DataField="PD_PRICE"
        HtmlEncode="false"
        DataFormatString="{0:c}" 
        ItemStyle-HorizontalAlign="Right" ItemStyle-Width="60" 
        FooterStyle-BackColor="Maroon" FooterStyle-ForeColor="White" FooterStyle-HorizontalAlign="Right"/>

    <asp:TemplateField HeaderText="Qty" HeaderStyle-BackColor="Maroon" HeaderStyle-ForeColor="White" 
        ItemStyle-HorizontalAlign="Right"
        FooterStyle-BackColor="Maroon" FooterStyle-ForeColor="White" FooterStyle-HorizontalAlign="Right">    
        <ItemTemplate>
            <asp:Label ID="ProductQty" runat="server" Text='<%#String.Format("{0:D}", Eval("CT_QTY")) %>' />
        </ItemTemplate>
        <FooterTemplate >
            <asp:Label ID="Label9" Text="Shipping" runat="server" /><br />
            <asp:Label ID="Label10" Font-Size="Large" Text="Total" runat="server" 
            Font-Bold="true"/>
        </FooterTemplate>
    </asp:TemplateField>
    
    <asp:TemplateField HeaderText="Amount" HeaderStyle-BackColor="Maroon" HeaderStyle-ForeColor="White" 
        ItemStyle-HorizontalAlign="Right"
        FooterStyle-BackColor="Maroon" FooterStyle-ForeColor="White" FooterStyle-HorizontalAlign="Right">
        <ItemTemplate>
            <asp:Label ID="Label11" runat="server"
                Text='<%#String.Format("{0:c}", Get_Amount(Eval("PD_PRICE"), Eval("CT_QTY"))) %>' />
        </ItemTemplate>
        <FooterTemplate>
            <asp:Label ID="Label13" runat="server"
                Text='<%#String.Format("{0:c}", Get_Shipping()) %>' /><br />
            <asp:Label ID="OrderTotal" runat="server"
                Text='<%#String.Format("{0:c}", Get_Order_Total()) %>' 
                Font-Bold="true" Font-Size="Large"/>
        </FooterTemplate>
    </asp:TemplateField>
    </Columns>
    
    
    
    </asp:GridView>
    <p> Thank you for your order! We appreciate you shopping at DevDivas~!
    If you have any questions about your order, contact us at <a href="">orders@devDivas.com</a>!</p>

</asp:Content>
